package com.huc.springframework.beans.factory.support;

import com.huc.springframework.beans.factory.config.BeanDefinition;
import com.huc.springframework.beans.factory.config.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: huchao
 * @date: 2021/9/18 17:47
 */
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {

    private Map<String, Object> singletionObjects = new HashMap<>();

    @Override
    public Object getSingleton(String beanName) {
        return singletionObjects.get(beanName);
    }

    protected void addSingleton(String beanName, Object singletonObject){
        singletionObjects.put(beanName, singletonObject);
    }
}
